<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx"
			   xmlns:personasoa="services.personasoa.*"
			   minWidth="955" minHeight="600">
	
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.controls.Alert;
			import mx.rpc.events.ResultEvent;
			protected function togglebutton1_clickHandler(event:MouseEvent):void
			{
				// TODO Auto-generated method stub
				
			}
			
			protected function button_clickHandler(event:MouseEvent):void
			{
				 personaSOA3.graficar();
			}
			
			public function recibeResultadoGraficar(e:ResultEvent):void{
				
	        var result2:String = e.result.toString();
			var result:Array = result2.split(',');
			
			var expreses_graficar:ArrayCollection = new ArrayCollection([
				{Nombre:"Mujer", cantidad:result[0]},
				{Nombre:"Hombre", cantidad:result[1]}]);
				
				piechart1.dataProvider=expreses_graficar;
			
			}
			
		]]>
	</fx:Script>
	
	<fx:Declarations>
		<s:CallResponder id="graficarResult"/>
		<personasoa:PersonaSOA id="personaSOA"
							   fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
							   showBusyCursor="true"/>
		<personasoa:PersonaSOA id="personaSOA3"
							   fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
							   showBusyCursor="true" result="recibeResultadoGraficar(event)"/>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<mx:PieChart id="nombre" x="78" y="10" width="346" height="293">
		<mx:series>
			<mx:PieSeries id="piechart1" displayName="nombre" field="nombre"/>
		</mx:series>
	</mx:PieChart>
	<mx:Legend dataProvider="{nombre}"/>
	<s:Button id="button" x="341" y="22" label="Graficar" click="button_clickHandler(event)"/>
</s:Application>
